<?php
namespace User\Controller;
use Common\Controller\MemberbaseController;
class TaskAdController extends MemberbaseController
{

	protected  function _taskInfo($tid)
	{
		$tid=empty($tid)?I("get.tid",0,"intval"):$tid;
		$task=M("taskShareList");
		$uid=get_current_userid();
		$result=$task->where("tid=$tid and uid=$uid")->find();
		$usersPub=unserialize($result["user"]);
		unset($result["user"]);
		foreach($usersPub as $k=>$v)
		{
			$result["userpub"][$k]=$v;
		}
		$this->assign($result);
	}
	/*
	 * 任务分配后 用户执行任务状态及详情
	 */
	protected  function _taskAllotState($tid)
	{
		$tid=empty($tid)?I("get.tid",0,"intval"):$tid;
		$where["tid"]=$tid;
		$where["gid"]=get_current_userid();
		$result=M("taskShareListuser")->where($where)->getField("uid,state,id");
		$this->assign("taskallotstas",$result);
	
	}
	
	
	
	//查看广告主发布的任务详情
	public function taskinfo()
	{
		$this->_taskInfo();
		$this->_taskAllotState();
		$this->display("taskinfo");
	}
	
	
	
	
	
}